const router = require("@koa/router")()
const mongo = require("../../model/api/index")
router.get("/", async (ctx) => {
  ctx.body = "欢迎来到user模块"
})

router.post("/add", async (ctx) => {
  ctx.body = "这是添加"
})

router.post("/del", async (ctx) => {
  ctx.body = "这是删除"
})

router.post("/update", async (ctx) => {
  ctx.body = "这是修改"
})
router.post("/inquire", async (ctx) => {
  let res = await mongo.find("user", {});
  if (res) {
    ctx.body = {
      code: 200,
      message: "成功",
      data: res
    }
  } else {
    ctx.body = "查询失败"
  }
  console.log(res)
})

module.exports = router